/**
 * 
 */
package br.com.ctm.advogadope.model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlEnumValue;
import javax.xml.bind.annotation.XmlID;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;

import br.com.framework.persistencia.model.AuditedEntity;

/**
 * @author Cleber
 *
 */
@Entity
@Table(name = "TRIBUNAL")
@XmlRootElement
public class Tribunal extends AuditedEntity {
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	/**
	 * @author ctm
	 *
	 */
	@XmlType(name = "tipoJuizo")
	public enum TipoJuizo {
		@XmlEnumValue("PRIMEIRO_GRAU")
		PRIMEIRO_GRAU,
		@XmlEnumValue("SEGUNDO_GRAU")
		SEGUNDO_GRAU;
	};

	private String nome;
	private Uf uf;
	private String sigla;
	
	private String pjeEndpoint1g;
	private String pjeEndpoint2g;
	
	/**
	 * 
	 */
	public Tribunal() {
	}
	
	@Id
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator="SEQ_TRIBUNAL")
	@SequenceGenerator(name="SEQ_TRIBUNAL", sequenceName="SEQ_TRIBUNAL", allocationSize=1, initialValue=0)
	@Column(name = "ID_TRIBUNAL")
	@XmlID
	public Long getId() {
		return super.getId();
	}
	
	/**
	 * @return the nome
	 */
	@Column(name = "NOME", length = 255, nullable = false, unique = true)
	@Size(min = 1, max = 255, message = "{geral.campo.texto.tamanhoInvalido}")
	public String getNome() {
		return nome;
	}

	/**
	 * @param nome the nome to set
	 */
	public void setNome(String nome) {
		this.nome = nome;
	}

	@Column(name = "SIGLA", length = 12, nullable = false, unique = true)
	@Size(min = 1, max = 12, message = "{geral.campo.texto.tamanhoInvalido}")
	public String getSigla() {
		return sigla;
	}

	public void setSigla(String sigla) {
		this.sigla = sigla;
	}

	@ManyToOne(targetEntity = Uf.class, optional = false)
	@JoinColumn(name="ID_UF", nullable = false)
	public Uf getUf() {
		return uf;
	}

	public void setUf(Uf uf) {
		this.uf = uf;
	}

	@Column(name = "PJE_ENDPOINT_1G", length = 2000, nullable = true)
	@Size(min = 1, max = 2000, message = "{geral.campo.texto.tamanhoInvalido}")
	public String getPjeEndpoint1g() {
		return pjeEndpoint1g;
	}

	public void setPjeEndpoint1g(String pjeEndpoint) {
		this.pjeEndpoint1g = pjeEndpoint;
	}

	@Column(name = "PJE_ENDPOINT_2G", length = 2000, nullable = true)
	@Size(min = 1, max = 2000, message = "{geral.campo.texto.tamanhoInvalido}")
	public String getPjeEndpoint2g() {
		return pjeEndpoint2g;
	}

	public void setPjeEndpoint2g(String pjeEndpoint2g) {
		this.pjeEndpoint2g = pjeEndpoint2g;
	}
	

}
